﻿'
' Brandon Haynes - http://brandonhaynes.org
' Copyright (c) 2008
' by Brandon Haynes
'
' Please refer to the project license, located at http://www.codeplex.com/DNNLocalization/license
'
' The above copyright notice and this permission notice shall be included in all copies or substantial portions 
' of the Software.
'
'THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
'INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
'DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
'SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
'SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
'WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 
'USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

Namespace BrandonHaynes.DotNetNukeResXBuildProvider.LocalizationModule
	Partial Class View
		Inherits DotNetNuke.Entities.Modules.PortalModuleBase


		Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
			MyBase.OnLoad(e)

			If (Not Resources.GlobalResources.Culture Is Nothing) Then
				CurrentCulture.Text = Resources.GlobalResources.Culture.DisplayName
			Else
				CurrentCulture.Text = CultureInfo.CurrentUICulture.DisplayName
			End If

			SetStronglyTypedValues()
			SetGetStringValues()
			SetDNNValues()
		End Sub

		Private Sub SetStronglyTypedValues()
			Dim currentCulture As CultureInfo = Resources.GlobalResources.Culture

			StronglyTypedCurrentValue.Text = Resources.GlobalResources.Error_Text

			Resources.GlobalResources.Culture = CultureInfo.GetCultureInfo("en-US")
			StronglyTypedEnUsValue.Text = Resources.GlobalResources.Error_Text

			Resources.GlobalResources.Culture = CultureInfo.GetCultureInfo("en-GB")
			StronglyTypedEnUkValue.Text = Resources.GlobalResources.Error_Text

			Resources.GlobalResources.Culture = CultureInfo.GetCultureInfo("de-DE")
			StronglyTypedDeDeValue.Text = Resources.GlobalResources.Error_Text

			Resources.GlobalResources.Culture = CultureInfo.GetCultureInfo("de")
			StronglyTypedDeValue.Text = Resources.GlobalResources.Error_Text

			Resources.GlobalResources.Culture = currentCulture
		End Sub

		Private Sub SetGetStringValues()
			GetStringCurrentValue.Text = Resources.GlobalResources.ResourceManager.GetString(ASPNETResourceName.Text)
			GetStringEnUsValue.Text = Resources.GlobalResources.ResourceManager.GetString(ASPNETResourceName.Text, CultureInfo.GetCultureInfo("en-US"))
			GetStringEnUkValue.Text = Resources.GlobalResources.ResourceManager.GetString(ASPNETResourceName.Text, CultureInfo.GetCultureInfo("en-GB"))
			GetStringDeDeValue.Text = Resources.GlobalResources.ResourceManager.GetString(ASPNETResourceName.Text, CultureInfo.GetCultureInfo("de-DE"))
			GetStringDeValue.Text = Resources.GlobalResources.ResourceManager.GetString(ASPNETResourceName.Text, CultureInfo.GetCultureInfo("de"))
		End Sub

		Private Sub SetDNNValues()

			DNNCurrentValue.Text = Localization.GetString(DNNResourceName.Text, DotNetNuke.Services.Localization.Localization.GlobalResourceFile)
			DNNEnUsValue.Text = Localization.GetString(DNNResourceName.Text, DotNetNuke.Services.Localization.Localization.GlobalResourceFile, "en-US")
			DNNEnUkValue.Text = Localization.GetString(DNNResourceName.Text, DotNetNuke.Services.Localization.Localization.GlobalResourceFile, "en-GB")
			DNNDeDeValue.Text = Localization.GetString(DNNResourceName.Text, DotNetNuke.Services.Localization.Localization.GlobalResourceFile, "de-DE")
			DNNDeValue.Text = Localization.GetString(DNNResourceName.Text, DotNetNuke.Services.Localization.Localization.GlobalResourceFile, "de")
		End Sub
	End Class
End Namespace